﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DDDProjectSample.Domain
{
    public class Message : Entity
    {
        private String _text;
        private DateTime _creationDate;
        private Member _author;
        private Topic _topic;

        /// <summary>
        /// Creates a new instance of class Message
        /// </summary>
        protected Message()
        {
        }

        /// <summary>
        /// Creates a new instance of class Message
        /// </summary>
        /// <param name="text">Text of the message</param>
        /// <param name="author">User who creates the forum</param>
        /// <param name="topic">Topic that the message belongs to</param>
        public Message(
            String text,
            Member author,
            Topic topic)
        {
            _text = text;
            _creationDate = DateTime.Now;
            _author = author;
            _topic = topic;
        }

        /// <summary>
        /// Gets the message's full text
        /// </summary>
        public virtual String Text
        {
            get { return _text; }
        }

        /// <summary>
        /// Gets the message's creation date
        /// </summary>
        public virtual DateTime CreationDate
        {
            get { return _creationDate; }
        }

        /// <summary>
        /// Gets the user who creates the message
        /// </summary>
        public virtual Member Author
        {
            get { return _author; }
        }

        /// <summary>
        /// Gets the topic that the message belongs to
        /// </summary>
        public virtual Topic Topic
        {
            get { return _topic; }
        }
    }
}
